package com.bruce.codeFactory.Thread;

/**
 * @author luotuan
 * @Description   同步块例子
 * @create 2019-02-19 20:25
 **/
public class SynchronizedDemo {
    private final static Object LOCK = new Object();
    public static void main(String[] args) {
        Runnable runnable = ()->{
          synchronized (LOCK){
              try {
                  Thread.sleep(100_000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
          }
        };
        Thread t1 = new Thread(runnable);
        Thread t2 = new Thread(runnable);
        Thread t3 = new Thread(runnable);
        t1.start();
        t2.start();
        t3.start();
    }
}
